/*
 * MagnetDataChannelDef.java
 *
 * Created on September 3, 2002, 6:18 PM
 *
 * Copyright (c) 2002 The General Electric Company
 */

package com.ge.healthcare.autosc.processor.shemjob.guidance.dataset;

/**
 * Definition of a single magnet monitoring channel.  This is typically
 *  used when extracting and formatting data from ASCII magnet data.
 * Objects of this class are typically created from configuration data
 *  and then queried to guide the extraction and formatting of data.
 *
 * @author Daniel S. Horwitz, Compuware Corp.
 *
 * @version AutoSC P5P6
 */
public class MagnetDataChannelDef
{
    /**
     * The name of the channel.
     */
    private String theChannelName = null;

    /**
     * Index of the channel in the ASCII magnet data.
     */
    private int theChannelIndex = 0;

    /**
     * Format to use when creating a fixed point value from the channel
     *  value.  This is also used when creating strings for an
     *  <iri-data-list>.
     */
    private String theFormatString = null;

    /**
     * Maximum value for the channel.  If the channel value exceeds this
     *  value, this value is used instead.
     */
    private float theChannelMaxValue = 0.0f;

    /**
     * Construct a magnet data channel definition.
     *
     * @param channelName The name of the channel.
     *
     * @param channelIndex Index of the channel in the ASCII magnet data.
     *
     * @param formatString Format to use when creating a fixed point value
     *  from the channel value.  This is also used when creating strings for
     *  an &lt;iri-data-list&gt;.
     *
     * @param channelMaxValue Maximum value for the channel.  If the channel
     *  value exceeds this value, this value is used instead.
     */
    public MagnetDataChannelDef( String channelName,
                                 int channelIndex,
                                 String formatString,
                                 float channelMaxValue )
    {
        theChannelName = channelName;
        theChannelIndex = channelIndex;
        theFormatString = formatString;
        theChannelMaxValue = channelMaxValue;
    }

    /**
     * Get the name of the channel.
     *
     * @return The name of the channel.
     */
    public String getChannelName()
    {
        return theChannelName;
    }

    /**
     * Get the index of the channel in the ASCII magnet data.
     *
     * @return Index of the channel in the ASCII magnet data.
     */
    public int getChannelIndex()
    {
        return theChannelIndex;
    }

    /**
     * Get the format to use when creating a fixed point value from the
     *  channel value.  This is also used when creating strings for an
     *  &lt;iri-data-list&gt;.
     *
     * @return Format string for the channel.
     */
    public String getFormatString()
    {
        return theFormatString;
    }

    /**
     * Get the maximum value for the channel.  If the channel value exceeds
     *  this value, this value is used instead.
     *
     * @return Maximum value for the channel.
     */
    public float getChannelMaxValue()
    {
        return theChannelMaxValue;
    }

    /**
     * Return a string representation of the object.
     *
     * @return A string representation of the object.
     */
    public String toString()
    {
        return "{" +
               theChannelName +
               "," +
               theChannelIndex +
               "," +
               theFormatString +
               "," +
               theChannelMaxValue +
               "}";
    }
}
